package org.zlb.netty.server.udp;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.DatagramPacket;
import io.netty.util.CharsetUtil;

public class ChinesProverServerHandler extends SimpleChannelInboundHandler<DatagramPacket>{

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
        ByteBuf data = Unpooled.copiedBuffer("中华成语故事大全", CharsetUtil.UTF_8);
        ctx.writeAndFlush(new DatagramPacket(data, msg.sender()));
    }

}
